#include <stdio.h>
int main()
{
  FILE* fp = fopen("/home/xyc/log.txt","r");
  if(fp == NULL)
  {
    perror("fopen fail!\n");
    return -1;
  }
  char buffer[64];
  while(1)
  {
    char* r = fgets(buffer,sizeof(buffer),fp);
    if(!r) break;

    printf("%s",buffer);//写文件带了'\n',这里输出就不用带了。
  }

  return 0;
}
